home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / System 7.0 Samples / AEObject-Edition1.0.2 Sample / globals.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  4.4 KB  |  114 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. *
  3. *  Apple Developer Technical Support
  4. *
  5. *  Global variables for this sample
  6. *
  7. *  Program:    AEObject-Edition Sample
  8. *  File:       Files.c -   C Source
  9. *
  10. *  by:         C.K. Haun <TR>
  11. *
  12. *  Copyright © 1990-1992 Apple Computer, Inc.
  13. *  All rights reserved.
  14. *
  15. *------------------------------------------------------------------------------
  16. * All our globals.
  17. * Probably more than you would use in a commercial application, but I created
  18. * many of these to make the sample easier to understand.  I hope it did.
  19. *----------------------------------------------------------------------------*/
  20. #ifndef __GLOBALS__
  21. #define __GLOBALS__
  22. #include "Sampdefines.h"
  23. Boolean gHasColor = false;
  24. short gCurrentColor = 1;    /* defaults to black */
  25. RGBColor gColorArray[7] = {
  26. {0,0,0},
  27. {0,0,0},
  28. {0,0,0xFFFF},
  29. {0,0xFFFF,0},
  30. {0xFFFF,0,0},
  31. {0xFFFF,0xFFFF,0},
  32. {0,0,0}
  33. };
  34. AEInteractAllowed gInteractLevel;
  35.  
  36. Handle gScrapData;                                          /* picture data currently on clipboard */
  37. /* individual menu handles */
  38. MenuHandle gAppleMenuHandle, gFileMenuHandle, gEditMenuHandle, gToolMenuHandle,
  39. gAppleEventMenuHandle,gEditionMenuHandle,gWindowMenuHandle,gColorMenuHandle;
  40. short gHelpItem; /* our added help menu item */
  41. Boolean gStop;                                              /* Stop flag for this app */
  42. unsigned long gMasterWindowID = 10000;                      /* for section tracking */
  43. Rect gShowPubRect;                                          /* rectangle of the currently selected publisher */
  44. Rect gShowSubRect;                                          /* rectangle of the currently selected subscriber */
  45. SectionHandle gShowingSecHandle = nil;                      /* currently selected section */
  46. SectionHandle gClipSection = nil;                           /* if the clipboard contains a section */
  47. PicHandle gClipPict;                                        /* for the section picture */
  48. Boolean gShowPub = false;                                   /* telling if a publisher or subscriber */
  49. Boolean gShowSub = false;                                   /* border should be displayed */
  50. Boolean gShowingAll = false;                                /* show all borders toggle */
  51. Boolean gInBackground = false;                              /* Where Are We? */
  52. Boolean gExpanded = false;                                  /* flag for expanded dialogs, for this sample */
  53. Boolean gResizeSub = false;                                 /* resize flag for this sample */
  54. short gClipHasContents = kClipEmpty;                        /* indicates the contents of the clipboard (PICT, TEXT, section ) */
  55. EventRecord gERecord;                                       /* guess */
  56. ProcessSerialNumber gOurSN;                                 /* serial number of this process (us, our application) */
  57. Boolean gHasAppleEvents;                                    /* not really necessary, since we fail if these */
  58. Boolean gHasEditionManager;                                 /* aren't available, but it's only 4 bytes.... */
  59.  
  60.  
  61. short actsToIDs[6] =                                        /* converts my action codes to tool menu item IDs */
  62. {
  63.     0, 1, 2, 3, 4, 6
  64. };
  65.  
  66.  
  67.  
  68. SectionHandle gLastSection;                                  /* for double click testing */
  69. unsigned long gLastSecClickTick;
  70. RgnHandle mousergn;                                     /* for WaitNextEvent */
  71.  
  72. SFTypeList myList = 
  73. {
  74.     kMyDocumentFileType
  75. };
  76.  
  77. SectionHandle gSecHandle;
  78. EditionRefNum gEdRefNum;
  79. EditionContainerSpec gEdSpec;
  80. unsigned long gSectionID = 1;
  81. long gMySleep;
  82. prefStruct gPreferences;
  83. /* some globals for AppleEvent transactions */
  84.  
  85. short gLocalInteraction;
  86. short gAESendInteraction;
  87. AEDesc gTargetAddress;
  88. AEDesc gNullDesc;    /* seed nul deeescriptor, does not have to be a global, you can recreate it */
  89.                     /* all the time if you want, but I like doing it this way*/
  90. AEDesc * gCurrentReply;    /* so anyone can add error descriptors */
  91. Str63 targetName;
  92. Boolean gAESwitchLayer;
  93. short gAddressMode;
  94. short gReplyMode;
  95. /* here are the global handles for how we're specifying our */
  96. /* objects */
  97. /* See the AESampStructs.h file for the definition of these handles */
  98. WindowObjectDefHandle gWindObjSpecHandle;
  99. TextObjectDefHandle gTextObjSpecHandle;
  100. ShapeObjectDefHandle gShapeObjSpecHandle;
  101.  
  102. short gSendInteractArray[] = 
  103. {
  104. kAENeverInteract, kAECanInteract, kAEAlwaysInteract, 
  105. };
  106.  
  107. short gReplyLevels[] = 
  108. {
  109.     kAENoReply, kAEWaitReply,kAEQueueReply
  110. };
  111.  
  112.  
  113. #endif /* defined */
  114.